package com.example.wordcardjavaproject.controller;

import com.example.wordcardjavaproject.bean.entity.User;
import com.example.wordcardjavaproject.service.UserService;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@RestController
public class UserController {
    @Resource
    UserService userService;

    @RequestMapping(value = "/addUser", method = RequestMethod.POST)
    public Object addUser(@RequestBody User user) {
        userService.addUser(user);
        Map<Object, Object> map = new HashMap<>();
        map.put("code", 200);
        return map;
    }
}
